<?php

use Illuminate\Database\Seeder;

class ShopTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $shops = [
            [
                'company_id' => '1',
                'name' => '天创路店',
                'code' => 'TR-001',
            ],
            [
                'company_id' => '2',
                'name' => '黄河路店',
                'code' => 'TR-002',
            ],
            [
                'company_id' => '3',
                'name' => '珠江路店',
                'code' => 'TR-003',
            ],
            [
                'company_id' => '1',
                'name' => '天山西路店',
                'code' => 'TR-004',
            ],
        ];

        DB::table('shops')->insert($shops);

        // 组织添加业务员
        DB::table('shop_user_pivot')->insert([
            'shop_id' => '1',
            'user_id' => '3',
        ]);

        // 组织添加参数
        $shop_task_pivot = [
            [
                'shop_id' => '1',
                'task_id' => '1',
            ],
            [
                'shop_id' => '1',
                'task_id' => '2',
            ],
            [
                'shop_id' => '1',
                'task_id' => '3',
            ],
            [
                'shop_id' => '1',
                'task_id' => '4',
            ],
        ];

        DB::table('shop_task_pivot')->insert($shop_task_pivot);
    }
}
